//
//  GetHeightTools.m
//  网易新闻段子
//
//  Created by 洛洛大人 on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GetHeightTools.h"

@implementation GetHeightTools

+(CGFloat)heightWith:(NSString *)text {
    
    NSDictionary *attributesDic = @{
                                    NSFontAttributeName:[UIFont systemFontOfSize:17]
                                    };
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 20, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
    
    return rect.size.height;
    
}

+(CGFloat)imageHeightWith:(NSString *)imageName{
    NSURL *url = [NSURL URLWithString:imageName];
    NSData *data = [NSData dataWithContentsOfURL:url];
    
    UIImage *image = [UIImage imageWithData:data];
    
    CGFloat height = image.size.height * [UIScreen mainScreen].bounds.size.width / 10;
    return height;
    
    
}





@end
